<?php
// $Id: mod_jtssnap.php,v 1.0B 20/09/2007 22:12:19 RussW $
/**
 * JTSsnap Administrator Control Panel Module has been for the cpanel position and will display
 * a configuration SnapShot based on the Joomla Tools Suite Audit requirements.
 *
 * @package mod_jtssnap
 * @copyright (C) Copyright 2007 JustJoomla! All Rights Reserved.
 * @license GNU/GPL
 * @author RussW <enquiries@justjoomla.com.au>
 */
// no direct access
defined( '_VALID_MOS' ) or die( 'Restricted access' );



$params->def('security', 1);
$params->def('joomla', 1);
$params->def('config', 1);
$params->def('host', 1);

global $_VERSION, $mosConfig_dbprefix, $mosConfig_absolute_path, $mosConfig_offline, $mosConfig_caching,$mosConfig_cachepath, $mosConfig_host;
$J_CMS = 'CMS';
$J_VER = '';
if (isset($_VERSION)) {
    if (isset($_VERSION->PRODUCT)) {
        $J_CMS = $_VERSION->PRODUCT;
        $J_VER = $_VERSION->RELEASE;

		$version = $_VERSION->PRODUCT .' '. $_VERSION->RELEASE .'.'. $_VERSION->DEV_LEVEL .' '
		. $_VERSION->DEV_STATUS .' [ '.$_VERSION->CODENAME .' ] '. $_VERSION->RELDATE;
    }
}

	if ($J_VER === "1.0") {
		$joomlaIcon = "../includes/js/ThemeOffice/joomla_16x16.png";
	} else if ($J_VER === "1.5") {
		$joomlaIcon = "templates/khepri/images/mini_icon.png";
	}
		$configIcon = "images/properties_f2.png";
		$securityIcon = "images/security_f2.png";
		$downloadIcon = "images/download_f2.png";
		$systemIcon = "images/preview_f2.png";
		$jIcon = "images/publish_f2.png";
//		$attentionIcon = "../includes/js/dtree/img/question.gif";
		$attentionIcon = "../includes/js/dtree/img/page.gif";
//		$attentionIcon = "../includes/js/ThemeOffice/warning.png";
//		$attentionIcon = "../includes/js/ThemeOffice/language.png";

	echo "<div style='text-align: center; border: 1px solid #e6e6fa; background-color: #ffffff; padding: 2px; margin: 5px; height: 32px;'><img src='". $joomlaIcon ."'><br />". $version ."</div><br clear='all'/>";

	// Only Super Administrators....
	if ( $my->usertype != "Super Administrator" ) {
		echo "<div style='text-align: center;'>You must be a Super Administrator to view this resource.</div>";
	} else {

	// build the overlib
	$overlibSecurity = '';
	$overlibJoomla = '';
	$overlibConfig = '';
	$overlibHost = '';
?>

	<script language="javascript" type="text/javascript" src="<?php echo $mosConfig_live_site; ?>/includes/js/overlib_mini.js"></script>
	<script language="javascript" type="text/javascript" src="<?php echo $mosConfig_live_site; ?>/includes/js/overlib_hideform_mini.js"></script>

<?php
	// See if JTSc is installed and show the latest JTSc Rating if it is, otherwise show download link...
	if (file_exists($mosConfig_absolute_path ."/administrator/components/com_jts/jts.xml")) {
		echo "<a href='index2.php?option=com_jts&task=jts'>";

		$jtsquery = "SELECT * FROM ". $mosConfig_dbprefix ."jts";
		$jtsresult = mysql_query ($jtsquery);

		while ( $jtsRating = mysql_fetch_array($jtsresult) )
		{
		// Rating Testing
		// $jtsRating['lastrate'] = '95';
			if ($jtsRating['lastrate'] >= '90') { $rateColor = "green"; $rateIcon = "images/publish_g.png"; } else if ($jtsRating['lastrate'] >= "85") { $rateColor = "orange"; $rateIcon = "images/publish_y.png"; } else if ($jtsRating['lastrate'] >= "41") { $rateColor = "black"; $rateIcon = "images/publish_r.png"; } else { $rateColor = "red"; $rateIcon = "images/disabled.png"; }
			echo "<div style='background-image: url(". $rateIcon ."); background-repeat: no-repeat; background-position: center 5px; float: left; vertical-align: middle; text-align: center; border: 1px solid #e6e6fa; background-color: #f0fff0; padding: 5px; margin: 5px; height: 45px; width: 65px; vertical-align: bottom;'>";
			echo "<span style='font-size: 14px; color: ". $rateColor .";'><br /><strong>". $jtsRating['lastrate'] ." %</strong></span><br />JTSc Rating</div></a>";
		}
	} else { // com_jts installed
			echo "<div style='float: left; vertical-align: middle; text-align: center; border: 1px solid #e6e6fa; background-color: #f0fff0; padding: 5px; margin: 5px; height: 45px; width: 65px;'><a href='http://joomlacode.org/gf/project/jts/frs/?action=FrsReleaseBrowse&frs_package_id=2860' target='JTSc'><img src='". $downloadIcon."' border='0'></a><br /><span style='font-size: 6px; color: navy;'>Install JTSc</span></div>";
	}




/* Start Security SnapShot */
	if ($params->get('security')) {

		// writable configuration
		if (!is_writable( $mosConfig_absolute_path .'/configuration.php' )) {
		    $overlibSecurity .= "<div style=\'background-color: #f0f8ff; red; border: 1px solid #E6E6E6; margin: 2px;\'>"
			.'<img src=images/publish_r.png>&nbsp;configuration.php Writable'
	        .'</div>';
			$attentionSecurity = "1";
		} else { 
		    $overlibSecurity .= "<div style=\'background-color: #f0f8ff; color: green; border: 1px solid #E6E6E6; margin: 2px;\'>"
			.'<img src=images/publish_g.png>&nbsp;configuration.php Read Only'
	        .'</div>';
		}

		// Default admin acocunt
		$adminquery = "SELECT * FROM ". $mosConfig_dbprefix ."users WHERE usertype = 'Super Administrator'";
		$adminresult = mysql_query ($adminquery);
		while ( $adminUser = mysql_fetch_array($adminresult) )
		{
	    	if ($adminUser['username'] == 'admin') {
			    $overlibSecurity .= "<div style=\'background-color: #FFFFFF; color: red; border: 1px solid #E6E6E6; margin: 2px;\'>"
				.'<img src=images/publish_r.png>&nbsp;Default admin Present'
		        .'</div>';
				$attentionSecurity = "1";
			} else { 
			    $overlibSecurity .= "<div style=\'background-color: #FFFFFF; color: green; border: 1px solid #E6E6E6; margin: 2px;\'>"
				.'<img src=images/publish_g.png>&nbsp;Default admin Not Present'
		        .'</div>';
			}
		}

		// PHP magic_quotes
	    if (ini_get('magic_quotes_gpc') != '1') {
		    $overlibSecurity .= "<div style=\'background-color: #FFFFFF; color: red; border: 1px solid #E6E6E6; margin: 2px;\'>"
			.'<img src=images/publish_r.png>&nbsp;Magic Quotes Off'
	        .'</div>';
			$attentionSecurity = "1";
		} else { 
		    $overlibSecurity .= "<div style=\'background-color: #FFFFFF; color: green; border: 1px solid #E6E6E6; margin: 2px;\'>"
			.'<img src=images/publish_g.png>&nbsp;Magic Quotes On'
	        .'</div>';
		}

		// PHP register_globals
	    if (ini_get('register_globals') == '1') {
		    $overlibSecurity .= "<div style=\'background-color: #FFFFFF; color: red; border: 1px solid #E6E6E6; margin: 2px;\'>"
			.'<img src=images/publish_r.png>&nbsp;PHP Register Globals On'
	        .'</div>';
			$attentionSecurity = "1";
		} else { 
		    $overlibSecurity .= "<div style=\'background-color: #FFFFFF; color: green; border: 1px solid #E6E6E6; margin: 2px;\'>"
			.'<img src=images/publish_g.png>&nbsp;PHP Register Globals Off'
	        .'</div>';
		}

		// Only if version 1.0, Joomla! RG_EMULATION
	    if ($J_VER =='1.0') {
	        if (RG_EMULATION != 0) {
			    $overlibSecurity .= "<div style=\'background-color: #FFFFFF; color: red; border: 1px solid #E6E6E6; margin: 2px;\'>"
				.'<img src=images/publish_r.png>&nbsp;RG_EMULATION On'
		        .'</div>';
				$attentionSecurity = "1";
			} else { 
			    $overlibSecurity .= "<div style=\'background-color: #FFFFFF; color: green; border: 1px solid #E6E6E6; margin: 2px;\'>"
				.'<img src=images/publish_g.png>&nbsp;RG_EMULATION Off'
		        .'</div>';
			}
	    }

		// PHP fopen
	    if (ini_get('allow_url_fopen')) {
		    $overlibSecurity .= "<div style=\'background-color: #FFFFFF; color: orange; border: 1px solid #E6E6E6; margin: 2px;\'>"
			.'<img src=images/publish_y.png>&nbsp;URL fopen Enabled'
	        .'</div>';
		} else { 
			    $overlibSecurity .= "<div style=\'background-color: #FFFFFF; color: green; border: 1px solid #E6E6E6; margin: 2px;\'>"
			.'<img src=images/publish_g.png>&nbsp;URL fopen Disabled'
	        .'</div>';
		}

		// PHP exec
	    if (function_exists('exec')) {
		    $overlibSecurity .= "<div style=\'background-color: #FFFFFF; color: orange; border: 1px solid #E6E6E6; margin: 2px;\'>"
			.'<img src=images/publish_y.png>&nbsp;PHP exec Enabled'
	        .'</div>';
		} else { 
			    $overlibSecurity .= "<div style=\'background-color: #FFFFFF; color: green; border: 1px solid #E6E6E6; margin: 2px;\'>"
			.'<img src=images/publish_y.png>&nbsp;PHP exec Disabled'
	        .'</div>';
		}

		// PHP shell_exec
	    if (function_exists('shell_exec')) {
		    $overlibSecurity .= "<div style=\'background-color: #FFFFFF; color: orange; border: 1px solid #E6E6E6; margin: 2px;\'>"
			.'<img src=images/publish_y.png>&nbsp;PHP shell_exec Enabled'
	        .'</div>';
		} else { 
			    $overlibSecurity .= "<div style=\'background-color: #FFFFFF; color: green; border: 1px solid #E6E6E6; margin: 2px;\'>"
			.'<img src=images/publish_y.png>&nbsp;PHP shell_exec Disabled'
	        .'</div>';
		}

		// PHP passthru
	    if (function_exists('passthru')) {
		    $overlibSecurity .= "<div style=\'background-color: #FFFFFF; color: orange; border: 1px solid #E6E6E6; margin: 2px;\'>"
			.'<img src=images/publish_y.png>&nbsp;PHP passthru Enabled'
	        .'</div>';
		} else { 
			    $overlibSecurity .= "<div style=\'background-color: #FFFFFF; color: green; border: 1px solid #E6E6E6; margin: 2px;\'>"
			.'<img src=images/publish_y.png>&nbsp;PHP passthru Disabled'
	        .'</div>';
		}

		$overlibSecurity = 'onmouseover="return overlib(\''.$overlibSecurity.'\', CAPTION, \'Security Environment\', BELOW, RIGHT);" onmouseout="return nd();"';

		if ($attentionSecurity < "1") {
			echo "<div ". $overlibSecurity ." style='float: left; text-align: center; border: 1px solid #e6e6fa; background-color: #f0fff0; padding: 5px; margin: 5px; height: 45px; width: 65px;'><img src='". $securityIcon ."'><br />Security</div>";
		} else {
			echo "<div ". $overlibSecurity ." style='float: left; text-align: center; border: 1px solid #e6e6fa; background-image: url(". $attentionIcon ."); background-position: 1px 1px; background-repeat: no-repeat; background-color: #f0fff0; padding: 5px; margin: 5px; height: 45px; width: 65px;'><img src='". $securityIcon ."'><br />Security</div>";
		}
	}

/* Start Joomla! SnapShot... */
	if ($params->get('joomla')) { 

		if ($mosConfig_offline == "1") {
		    $overlibJoomla .= "<div style=\'background-color: #FFFFFF; color: red; border: 1px solid #E6E6E6; margin: 2px;\'>"
			.'<img src=images/publish_r.png>&nbsp;Site is Offline'
	        .'</div>';
			$attentionJoomla = "1";
		} else { 
		    $overlibJoomla .= "<div style=\'background-color: #FFFFFF; color: green; border: 1px solid #E6E6E6; margin: 2px;\'>"
			.'<img src=images/publish_g.png>&nbsp;Site is Online'
	        .'</div>';
		}

		if ($mosConfig_sef != "1") {
		    $overlibJoomla .= "<div style=\'background-color: #FFFFFF; color: orange; border: 1px solid #E6E6E6; margin: 2px;\'>"
			.'<img src=images/publish_y.png>&nbsp;SEF is Disabled'
	        .'</div>';
		} else { 
		    $overlibJoomla .= "<div style=\'background-color: #FFFFFF; color: green; border: 1px solid #E6E6E6; margin: 2px;\'>"
			.'<img src=images/publish_g.png>&nbsp;SEF is Enabled'
	        .'</div>';
		}

		if ($mosConfig_caching != "1") {
		    $overlibJoomla .= "<div style=\'background-color: #FFFFFF; color: orange; border: 1px solid #E6E6E6; margin: 2px;\'>"
			.'<img src=images/publish_y.png>&nbsp;Cache is Disabled'
	        .'</div>';
		} else { 
			if (is_writeable($mosConfig_cachepath)) { $cacheStatus = '<img src=images/publish_g.png>&nbsp;Cache Directory Writeable'; } else { $cacheStatus = '<img src=images/publish_r.png>&nbsp;<font color=red>Cache Directory UnWriteable</font>'; $attentionJoomla = "1"; }
		    $overlibJoomla .= "<div style=\'background-color: #FFFFFF; color: green; border: 1px solid #E6E6E6; margin: 2px;\'>"
			.'<img src=images/publish_g.png>&nbsp;Cache is Enabled<br />'. $cacheStatus .''
	        .'</div>';
		}

		if ($mosConfig_debug == "1") {
		    $overlibJoomla .= "<div style=\'background-color: #FFFFFF; color: orange; border: 1px solid #E6E6E6; margin: 2px;\'>"
			.'<img src=images/publish_y.png>&nbsp;Site Debug Enabled'
	        .'</div>';
			$attentionJoomla = "1";
		} else { 
		    $overlibJoomla .= "<div style=\'background-color: #FFFFFF; border: 1px solid #E6E6E6; margin: 2px;\'>"
			.'<img src=images/publish_g.png>&nbsp;Site Debug Disabled'
	        .'</div>';
		}

	    if ($J_VER =='1.5') {
			if ($mosConfig_debug_db == "1") {
			    $overlibJoomla .= "<div style=\'background-color: #FFFFFF; color: orange; border: 1px solid #E6E6E6; margin: 2px;\'>"
				.'<img src=images/publish_y.png>&nbsp;dataBase Debug Enabled'
		        .'</div>';
			$attentionJoomla = "1";
			} else { 
			    $overlibJoomla .= "<div style=\'background-color: #FFFFFF; border: 1px solid #E6E6E6; margin: 2px;\'>"
				.'<img src=images/publish_g.png>&nbsp;dataBase Debug Disabled'
		        .'</div>';
			}

			if ($mosConfig_debug_lang == "1") {
			    $overlibJoomla .= "<div style=\'background-color: #FFFFFF; color: orange; border: 1px solid #E6E6E6; margin: 2px;\'>"
				.'<img src=images/publish_y.png>&nbsp;Language Debug Enabled'
		        .'</div>';
			$attentionJoomla = "1";
			} else { 
			    $overlibJoomla .= "<div style=\'background-color: #FFFFFF; border: 1px solid #E6E6E6; margin: 2px;\'>"
				.'<img src=images/publish_g.png>&nbsp;Language Debug Disabled'
		        .'</div>';
			}

			if ($mosConfig_ftp_enable == "1") {
			    $overlibJoomla .= "<div style=\'background-color: #FFFFFF; border: 1px solid #E6E6E6; margin: 2px;\'>"
				.'<img src=images/publish_y.png>&nbsp;FTP Layer Enabled'
		        .'</div>';
			} else { 
			    $overlibJoomla .= "<div style=\'background-color: #FFFFFF; border: 1px solid #E6E6E6; margin: 2px;\'>"
				.'<img src=images/publish_y.png>&nbsp;FTP Layer Disabled'
		        .'</div>';
			}

			if (!is_writable($mosConfig_log_path)) {
			    $overlibJoomla .= "<div style=\'background-color: #FFFFFF; color: orange; border: 1px solid #E6E6E6; margin: 2px;\'>"
				.'<img src=images/publish_y.png>&nbsp;Log Directory UnWritable'
		        .'</div>';
				$attentionJoomla = "1";
			} else { 
			    $overlibJoomla .= "<div style=\'background-color: #FFFFFF; color: green; border: 1px solid #E6E6E6; margin: 2px;\'>"
				.'<img src=images/publish_g.png>&nbsp;Log Directory Writable'
		        .'</div>';
			}

			if (!is_writable($mosConfig_tmp_path)) {
			    $overlibJoomla .= "<div style=\'background-color: #FFFFFF; color: orange; border: 1px solid #E6E6E6; margin: 2px;\'>"
				.'<img src=images/publish_y.png>&nbsp;Tmp Directory UnWritable'
		        .'</div>';
				$attentionJoomla = "1";
			} else { 
			    $overlibJoomla .= "<div style=\'background-color: #FFFFFF; color: green; border: 1px solid #E6E6E6; margin: 2px;\'>"
				.'<img src=images/publish_g.png>&nbsp;Tmp Directory Writable'
		        .'</div>';
			}
		}

		$overlibJoomla = 'onmouseover="return overlib(\''.$overlibJoomla.'\', CAPTION, \'Joomla! Environment\', BELOW, RIGHT);" onmouseout="return nd();"';
		if ($attentionJoomla < "1") {
			echo "<div ". $overlibJoomla ." style='float: left; text-align: center; border: 1px solid #e6e6fa; background-color: #f0fff0; padding: 5px; margin: 5px; height: 45px; width: 65px;'><img src='". $jIcon ."'><br />Joomla!</div>";
		} else {
			echo "<div ". $overlibJoomla ." style='float: left; text-align: center; border: 1px solid #e6e6fa; background-color: #f0fff0; background-image: url(". $attentionIcon ."); background-position: 1px 1px; background-repeat: no-repeat; padding: 5px; margin: 5px; height: 45px; width: 65px;'><img src='". $jIcon ."'><br />Joomla!</div>";
		}
	}

/* Start Host SnapShot */
	if ($params->get('config')) { 

		// PHP version support
		if ($J_VER == '1.0') {
	    	if (phpversion < '4.1') {
			    $overlibConfig .= "<div style=\'background-color: #FFFFFF; color: red; border: 1px solid #E6E6E6; margin: 2px;\'>"
				.'<img src=images/publish_r.png>&nbsp;PHP UnSupported (< 4.1)'
		        .'</div>';
				$attentionConfig = "1";
			} else { 
				    $overlibConfig .= "<div style=\'background-color: #FFFFFF; color: green; border: 1px solid #E6E6E6; margin: 2px;\'>"
				.'<img src=images/publish_g.png>&nbsp;PHP Supported (>= 4.1)'
		        .'</div>';
			}
		} else if ($J_VER == "1.5") {
	    	if (phpversion < '4.3') {
			    $overlibConfig .= "<div style=\'background-color: #FFFFFF; color: red; border: 1px solid #E6E6E6; margin: 2px;\'>"
				.'<img src=images/publish_r.png>&nbsp;PHP UnSupported (< 4.3)'
		        .'</div>';
				$attentionConfig = "1";
			} else { 
				    $overlibConfig .= "<div style=\'background-color: #FFFFFF; color: green; border: 1px solid #E6E6E6; margin: 2px;\'>"
				.'<img src=images/publish_g.png>&nbsp;PHP Supported (>= 4.3)'
		        .'</div>';
			}
		}

		// PHP File Uploads Enabled
    	if (ini_get('file_uploads') != '1') {
		    $overlibConfig .= "<div style=\'background-color: #FFFFFF; color: red; border: 1px solid #E6E6E6; margin: 2px;\'>"
			.'<img src=images/publish_r.png>&nbsp;PHP file uploads Disabled'
	        .'</div>';
			$attentionConfig = "1";
		} else { 
			    $overlibConfig .= "<div style=\'background-color: #FFFFFF; color: green; border: 1px solid #E6E6E6; margin: 2px;\'>"
			.'<img src=images/publish_g.png>&nbsp;PHP file uploads Enabled'
	        .'</div>';
		}

		// PHP zlib
    	if (!extension_loaded('zlib')) {
		    $overlibConfig .= "<div style=\'background-color: #FFFFFF; color: red; border: 1px solid #E6E6E6; margin: 2px;\'>"
			.'<img src=images/publish_r.png>&nbsp;PHP zlib Disabled'
	        .'</div>';
			$attentionConfig = "1";
		} else { 
			    $overlibConfig .= "<div style=\'background-color: #FFFFFF; color: green; border: 1px solid #E6E6E6; margin: 2px;\'>"
			.'<img src=images/publish_g.png>&nbsp;PHP zlib Enabled'
	        .'</div>';
		}

		// PHP xml
    	if (!extension_loaded('xml')) {
		    $overlibConfig .= "<div style=\'background-color: #FFFFFF; color: red; border: 1px solid #E6E6E6; margin: 2px;\'>"
			.'<img src=images/publish_r.png>&nbsp;PHP xml Disabled'
	        .'</div>';
			$attentionConfig = "1";
		} else { 
			    $overlibConfig .= "<div style=\'background-color: #FFFFFF; color: green; border: 1px solid #E6E6E6; margin: 2px;\'>"
			.'<img src=images/publish_g.png>&nbsp;PHP xml Enabled'
	        .'</div>';
		}


		if (ini_get('safe_mode')) {
		    $overlibConfig .= "<div style=\'background-color: #FFFFFF; color: red; border: 1px solid #E6E6E6; margin: 2px;\'>"
			.'<img src=images/publish_r.png>&nbsp;PHP safe_mode Enabled'
	        .'</div>';
			$attentionConfig = "1";
		} else { 
			    $overlibConfig .= "<div style=\'background-color: #FFFFFF; color: green; border: 1px solid #E6E6E6; margin: 2px;\'>"
			.'<img src=images/publish_g.png>&nbsp;PHP safe_mode Disabled'
	        .'</div>';
		}

		if (ini_get('open_basedir')) {
		    $overlibConfig .= "<div style=\'background-color: #FFFFFF; color: orange; border: 1px solid #E6E6E6; margin: 2px;\'>"
			.'<img src=images/publish_y.png>&nbsp;Open Base Directory :<br /><img src=images/publish_y.png>'. ini_get('open_basedir') .''
	        .'</div>';
		} else { 
			    $overlibConfig .= "<div style=\'background-color: #FFFFFF; border: 1px solid #E6E6E6; margin: 2px;\'>"
			.'<img src=images/publish_g.png>&nbsp;Open Base Directory : None'
	        .'</div>';
		}

		// PHP mysql
    	if (!function_exists('mysql_connect')) {
		    $overlibConfig .= "<div style=\'background-color: #FFFFFF; color: red; border: 1px solid #E6E6E6; margin: 2px;\'>"
			.'<img src=images/publish_r.png>&nbsp;PHP mysql Disabled'
	        .'</div>';
			$attentionConfig = "1";
		} else { 
			    $overlibConfig .= "<div style=\'background-color: #FFFFFF; color: green; border: 1px solid #E6E6E6; margin: 2px;\'>"
			.'<img src=images/publish_g.png>&nbsp;PHP mysql Enabled'
	        .'</div>';
		}

    	if (!function_exists('mysqli_connect')) {
		    $overlibConfig .= "<div style=\'background-color: #FFFFFF; color: red; border: 1px solid #E6E6E6; margin: 2px;\'>"
			.'<img src=images/publish_r.png>&nbsp;PHP mysqli Disabled'
	        .'</div>';
		} else { 
			    $overlibConfig .= "<div style=\'background-color: #FFFFFF; color: green; border: 1px solid #E6E6E6; margin: 2px;\'>"
			.'<img src=images/publish_g.png>&nbsp;PHP mysqli Enabled'
	        .'</div>';
		}

    	if (ini_get('short_open_tag')) {
		    $overlibConfig .= "<div style=\'background-color: #FFFFFF; color: orange; border: 1px solid #E6E6E6; margin: 2px;\'>"
			.'<img src=images/publish_y.png>&nbsp;PHP Short Open Tags Enabled'
	        .'</div>';
		} else { 
			    $overlibConfig .= "<div style=\'background-color: #FFFFFF; color: green; border: 1px solid #E6E6E6; margin: 2px;\'>"
			.'<img src=images/publish_g.png>&nbsp;PHP Short Open Tags Disabled'
	        .'</div>';
		}

		if ($J_VER == "1.5") {
	    	if (!extension_loaded('mbstring')) {
			    $overlibConfig .= "<div style=\'background-color: #FFFFFF; color: green; border: 1px solid #E6E6E6; margin: 2px;\'>"
				.'<img src=images/publish_g.png>&nbsp;PHP mbstring Loaded'
		        .'</div>';
			} else { 
				    $overlibConfig .= "<div style=\'background-color: #FFFFFF; color: orange; border: 1px solid #E6E6E6; margin: 2px;\'>"
				.'<img src=images/publish_y.png>&nbsp;PHP mbstring Not Loaded'
		        .'</div>';
			}

	    	if (!function_exists('iconv')) {
			    $overlibConfig .= "<div style=\'background-color: #FFFFFF; color: green; border: 1px solid #E6E6E6; margin: 2px;\'>"
				.'<img src=images/publish_g.png>&nbsp;PHP iconv Available'
		        .'</div>';
			} else { 
				    $overlibConfig .= "<div style=\'background-color: #FFFFFF; color: orange; border: 1px solid #E6E6E6; margin: 2px;\'>"
				.'<img src=images/publish_y.png>&nbsp;PHP iconv Not Available'
		        .'</div>';
			}
		}
		
		// Show memory usage
		if (function_exists('memory_get_usage')) {
		    $memoryUsage = memory_get_usage();
		    $mb = $memoryUsage / 1048576;
		    $overlibConfig .= "<div style=\'background-color: #FFFFFF; border: 1px solid #E6E6E6; margin: 2px;\'>"
			.$J_CMS.' used '.number_format($memoryUsage, 0, '', ',')
	        .' bytes ('.number_format($mb, 3).' MB) of memory.</div>';
		}

		$overlibConfig = 'onmouseover="return overlib(\''.$overlibConfig.'\', CAPTION, \'Configuration Environment\', BELOW, RIGHT);" onmouseout="return nd();"';

		if ($attentionConfig < "1") {
			echo "<div ". $overlibConfig ." style='float: left; text-align: center; border: 1px solid #e6e6fa; background-color: #f0fff0; padding: 5px; margin: 5px; height: 45px; width: 65px;'><img src='". $configIcon ."'><br />Configuration</div>";
		} else {
			echo "<div ". $overlibConfig ." style='float: left; text-align: center; border: 1px solid #e6e6fa; background-color: #f0fff0; background-image: url(". $attentionIcon ."); background-position: 1px 1px; background-repeat: no-repeat; padding: 5px; margin: 5px; height: 45px; width: 65px;'><img src='". $configIcon ."'><br />Configuration</div>";
		}
	}


/* PHP $ MySQL SnapShot */
	if ($params->get('host')) {

		// Show the User Account name and the WebServer User Account name
		if ((function_exists( 'passthru' )) || (function_exists( 'passthru' ))) {

	        if (function_exists( 'exec' )) { 
				$ApacheAcc = exec("whoami"); $UserAcc = get_current_user (); 
			} else if (function_exists( 'passthru' )) {
				$ApacheAcc = passthru("whoami"); $UserAcc = get_current_user (); 
			}
			    $overlibSystem .= "<div style=\'background-color: #FFFFFF; border: 1px solid #E6E6E6; margin: 2px;\'>"
				.'&nbsp;User Account&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp; '. $UserAcc .'<br />'
				.'&nbsp;Server Account&nbsp;:&nbsp; '. $ApacheAcc .''
		        .'</div>';
		}

		// show PHP version
	    $overlibSystem .= "<div style=\'background-color: #FFFFFF; border: 1px solid #E6E6E6; margin: 2px;\'>"
		.'&nbsp;PHP Version '.phpversion().''
        .'</div>';

		// show any disabled PHP functions
		if (ini_get('disable_functions')) {
		    $overlibSystem .= "<div style=\'background-color: #FFFFFF; border: 1px solid #E6E6E6; margin: 2px;\'>"
			.'&nbsp;Disabled PHP Functions :<br /> '. ini_get(disabled_functions) .''
	        .'</div>';
		} else {
		    $overlibSystem .= "<div style=\'background-color: #FFFFFF; border: 1px solid #E6E6E6; margin: 2px;\'>"
			.'&nbsp;No Disabled PHP Functions'
	        .'</div>';		
		}

		// PHP save_session.path
		$sp = ini_get( 'session.save_path' );
		if (is_writable( $sp )) { 
			$spState = '<font color=green>Writeable</font>'; } 
		else { 
			$spState = '<font color=red>Unwriteable</font>'; 
		}

	    $overlibSystem .= "<div style=\'background-color: #FFFFFF; border: 1px solid #E6E6E6; margin: 2px;\'>"
		.'&nbsp;PHP Session Path: &nbsp; '. $spState .''
		.'<br />&nbsp;'. $sp .''
        .'</div>';

	    $overlibSystem .= "<div style=\'background-color: #FFFFFF; border: 1px solid #E6E6E6; margin: 2px;\'>"
		.'&nbsp;MySQL Host:<br />&nbsp;-&nbsp;'. $mosConfig_host .''
        .'</div>';

	    $overlibSystem .= "<div style=\'background-color: #FFFFFF; border: 1px solid #E6E6E6; margin: 2px;\'>"
		.'&nbsp;MySQL Version:<br />&nbsp;-&nbsp;'. @mysql_get_server_info() .''
        .'</div>';

	    $overlibSystem .= "<div style=\'background-color: #FFFFFF; border: 1px solid #E6E6E6; margin: 2px;\'>"
		.'&nbsp;MySQL Client:<br />&nbsp;-&nbsp;'. @mysql_get_client_info() .''
        .'</div>';

	    $overlibSystem .= "<div style=\'background-color: #FFFFFF; border: 1px solid #E6E6E6; margin: 2px;\'>"
		.'&nbsp;MySQL Connection:<br />&nbsp;-&nbsp;'. @mysql_get_host_info() .''
        .'</div>';

		if (function_exists('mysql_client_encoding')) { 
		$charset = mysql_client_encoding();
	    	$overlibSystem .= "<div style=\'background-color: #FFFFFF; border: 1px solid #E6E6E6; margin: 2px;\'>"
			.'&nbsp;MySQL Encoding:<br />&nbsp;-&nbsp;'. $charset .''
	        .'</div>';
		}

		$status = explode('  ', @mysql_stat());
			if ($status[0]) { 
	    	$overlibSystem .= "<div style=\'background-color: #FFFFFF; border: 1px solid #E6E6E6; margin: 2px;\'>"
			//print_r($status);
			.'&nbsp;MySQL Statistics:<br />'
			.'&nbsp;-&nbsp;'. $status[0] .'<br />'
			.'&nbsp;-&nbsp;'. $status[1] .'<br />'
			.'&nbsp;-&nbsp;'. $status[2] .'<br />'
			.'&nbsp;-&nbsp;'. $status[3] .'<br />'
			.'&nbsp;-&nbsp;'. $status[4] .'<br />'
			.'&nbsp;-&nbsp;'. $status[5] .'<br />'
			.'&nbsp;-&nbsp;'. $status[6] .'<br />'
			.'&nbsp;-&nbsp;'. $status[7] .'<br />'
	        .'</div>';
		  }

		$overlibSystem = 'onmouseover="return overlib(\''.$overlibSystem.'\', CAPTION, \'System Environment\', BELOW, RIGHT);" onmouseout="return nd();"';
		echo "<div ". $overlibSystem ." style='float: left; text-align: center; border: 1px solid #e6e6fa; background-color: #f0fff0; padding: 5px; margin: 5px; height: 45px; width: 65px;'><img src='". $systemIcon ."'><br />System</div>";
	}

	
	
	} // not authorised (Not a Super Administrator)
	
	echo "<br clear='all'/><br /><a style='text-decoration: none;' href='http://joomlacode.org/gf/project/jts/frs/' target='_jts'><div style='text-align: center; border: 1px solid #e6e6fa; background-color: #ffffff; padding: 2px; margin: 5px; height: 32px;'>";
	if (file_exists("components/com_jts/jts.xml")) { 
		echo "<img src='components/com_jts/images/jts_icon.gif' border='0'>";
	}
	echo "<br />Joomla! Tools Suite Administrator SnapShot</div></a>"; 


?>
